package com.wanmait.zaisousuo.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class SysContext {

    private static ThreadLocal<HttpServletRequest> localRequest=new ThreadLocal<>();

    public static HttpServletRequest getRequest() {
        return localRequest.get();
    }
    public static void setRequest(HttpServletRequest request) {
        localRequest.set(request);
    }

    public static HttpSession getSession() {
        return (HttpSession)((HttpServletRequest)localRequest.get()).getSession();
    }
    //清空
    public static void clear()
    {
        localRequest.set(null);
    }

}
